package com.itheima.inetaddress;

import java.io.IOException;
import java.net.*;

public class Demo02 {
    public static void main(String[] args) throws IOException {
        //创建码头
        DatagramSocket ds = new DatagramSocket();
        //创建原料
        String s = "送给老丈人的礼物";
        byte[] bytes = s.getBytes();
        InetAddress address =InetAddress.getByName("徐谱盛");
        int port = 1000;
        //创建箱子
        DatagramPacket dp = new DatagramPacket(bytes,0,bytes.length,address,port);
        //送数据
        ds.send(dp);
        //释放资源
        ds.close();

    }
}
